namespace org.jawk.intermediate
{
	/// <summary>A pointer to a tuple within the list of tuples.</summary>
	/// <remarks>
	/// A pointer to a tuple within the list of tuples.
	/// Addresses are used for jumps, especially in reaction to
	/// conditional checks (i.e., if false, jump to else block, etc.).
	/// <p>
	/// Addresses have the following properties:
	/// <ul>
	/// <li>A name (label).
	/// <li>An index into the tuple queue.
	/// </ul>
	/// An address may not necessarily have an index assigned upon creation.
	/// However, upon tuple traversal, all address indexes must
	/// point to a valid tuple.
	/// <p>
	/// All addresses should have a meaningful label.
	/// </remarks>
	public interface IAddress
	{
		/// <summary>The label of the address.</summary>
		/// <remarks>
		/// The label of the address.  It is particularly useful when
		/// dumping tuples to an output stream.
		/// </remarks>
		/// <returns>The label of the tuple.</returns>
		string Label();

		/// <summary>Set the tuple index of this address.</summary>
		/// <remarks>
		/// Set the tuple index of this address.  This can be defered
		/// anytime after creation of the address, but the index must be
		/// assigned prior to traversing the tuples.
		/// </remarks>
		/// <param name="idx">
		/// The tuple location within the tuple list (queue)
		/// for this address.
		/// </param>
		void AssignIndex(int idx);

		/// <returns>The index into the tuple queue/array.</returns>
		int Index();
	}
}
